<?php $this->fetch('public/head') ?>
<div class="layui-tab layui-tab-brief">
    <ul class="layui-tab-title">
        <li class="layui-this">日志列表</li>
    </ul>
    <div class="layui-tab-content">
        <div class="layui-tab-item layui-show">
            <table id="dataList" lay-filter="dataList" class="layui-hide"></table>
        </div>
    </div>
</div>
<?php $this->fetch('public/script') ?>

<script>
    layui.use(['table'], function(){
        var table = layui.table
            ,form = layui.form;

        getLists();
        function getLists() {
            let params = HS.getParams('.query');
            //数据表格
            let load_table = layer.load(0, {time: 30000});
            table.render({
                elem: '#dataList'
                , height:$(window).height()-110
                , url: '<?php echo url('getLists') ?>' //数据接口
                , method: 'post'
                , where: params
                , response: {
                    countName: 'total' //数据总数的字段名称，默认：count
                }
                ,autoSort:false //后台排序
                , page: {
                    limit: 20
                    , limits: [20, 30, 50, 100]
                    , groups: 5
                    , layout: ['prev', 'page', 'next', 'limit', 'refresh', 'skip', 'count']
                } //开启分页
                , cols: [[ //表头
                    {type: 'checkbox', width: 40}
                    ,{field: 'id', title: 'ID', width: 50}
                    ,{field: 'user', title: '账号', width: '10%'}
                    , {field: 'ip', title: 'ip', width: '10%'}
                    , {field: 'content', title: '信息', width: '35%'}
                    , {field: 'add_time', title: '登录时间'}
                ]]
                , text: {none: '暂无相关数据'}
                , done: function (res, curr, count) {
                    layer.close(load_table);
                }
            })
        }
    });
</script>